<template>
  <div class="main_container">
    <el-container class="mainDiv">
      <el-main style="margin-top: 60px;">
        <el-form :model="form" ref="form" label-width="180px">
          <el-card shadow="hover">
            <el-form-item label="处置类型">
              <dict-tag :options="dict.type.deal_type" :value="form.disposalStat"/>
            </el-form-item>
            <customize-disposal-form :form="form"/>
            <el-form-item label="附件">
              <file-upload :fileSize="20" :file-size="undefined" ref="fileUpload"></file-upload>
            </el-form-item>
          </el-card>
        </el-form>
      </el-main>
      <el-footer>
        <el-button @click="submit" type="primary">下一步</el-button>
      </el-footer>
    </el-container>
  </div>
</template>

<script>
import CustomizeDisposalForm from '@/views/wms/deal/register/form/customizeDisposalForm'

export default {
  name: 'disposalForm',
  dicts: ['deal_type'],
  props: {
    disposalStat: {
      type: [String, Number]
    }
  },
  components: { CustomizeDisposalForm },
  data() {
    return {
      showRegister: false,
      form: {}
    }
  },
  watch: {
    disposalStat: {
      handler(value) {
        this.reset()
        this.$set(this.form, 'disposalStat', value)
      },
      immediate: true
    }
  },
  methods: {
    // 表单重置
    reset() {
      this.form = {}
      this.resetForm('form')
    },
    submit() {
      this.$refs['form'].validate(valid => {
        if (valid) {
          this.form.oss = this.$refs.fileUpload.pics
          this.$emit('next')
        }
      })
    }
  }
}
</script>

<style scoped>

</style>
